Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macos] Enable macOS platform views only for Metal #30853

Merged
merged 4 commits into from
Jan 20, 2022

Conversation

iskakaushik
Copy link
Contributor

@iskakaushik iskakaushik commented Jan 13, 2022

partially addresses: flutter/flutter#41722

@iskakaushik iskakaushik force-pushed the macos-pv branch 3 times, most recently from 74338e9 to 00422f0 Compare January 14, 2022 19:13
@iskakaushik iskakaushik changed the title [WIP] [macos] Enable macOS platform views only for Metal [macos] Enable macOS platform views only for Metal Jan 14, 2022
@iskakaushik iskakaushik marked this pull request as ready for review January 14, 2022 19:15
@cyanglaz
Copy link
Contributor

There are some threading issues to be addressed still to make this feature usable: [macos] Platform views must be mutated on Main thread flutter#96668

Can we do static thread merging (with a info.plist key) for this as a beta version?

Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % nits

* The plan is to only support platform views when using Metal rendering backend.
* This PR is based on the work done in: flutter#22905
* There are some threading issues to be addressed still to make this feature usable: flutter/flutter#96668
* Example is at: https://github.com/iskakaushik/flutter_macos_platform_view_example
* the Dart code, this will be null. Otherwise this will be the value sent from the Dart code as
* decoded by `createArgsCodec`.
*/
- (nonnull NSView*)createWithviewIdentifier:(int64_t)viewId arguments:(nullable id)args;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

view is incorrectly capitalized. This should be fixed ASAP as it is a breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing this at: #30996, I will make a follow up PR for the other issues raised.

* Only implement this if `createWithFrame` needs an arguments parameter.
*/
@optional
- (nullable NSObject<FlutterMessageCodec>*)createArgsCodec;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ideally shouldn't have "create" in the name; that's not standard naming for a getter. There's no reason this needs to create something every time.

#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterRenderingBackend.h"
#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterViewController_Internal.h"
#include "flutter/shell/platform/embedder/embedder.h"
#import "flutter/shell/platform/embedder/embedder.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change violates the style guide

/**
* Creates a platform view channel and sets up the method handler.
*/
- (void)setupPlatformViewChannel;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The verb is "set up", so this should be setUpPlatformViewChannel

@@ -219,6 +238,9 @@ - (instancetype)initWithName:(NSString*)labelPrefix
name:NSCurrentLocaleDidChangeNotification
object:nil];

_platformViewController = [[FlutterPlatformViewController alloc] init];
[self setupPlatformViewChannel];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should never call methods on self in init.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants